#ifndef SPELL_CORRECTION_
#define SPELL_CORRECTION_
#include"node_reformer.h"
#include"../model/language_model.h"
#include"../model/translate_model.h"
#include"../distance_calc.h"
class SpellCorrection : public NodeReformer
{
	private:
		double cost[MAX_QUERYLENGTH];
		string correct(string query);
		pair<string, double> get_prob(vector<string> v, int s, int e);
		map<string, int> lang_model, trans_model, corr2freq, ori2freq;
		map<string, set<string>> ori2corr;
		DistCalc *dist_calc;
		int total_freq;
	public:
		SpellCorrection(string lm, string tm, DistCalc *dist_calc);
		void reform(QueryNode &node);
		QueryNode reform_new(QueryNode &node);
};
#endif